from flask import Blueprint, session, redirect, request, url_for

admin_blue = Blueprint('admin', __name__, url_prefix='/admin')

from . import views


# 对是否是管理员用户做判断
@admin_blue.before_request
def check_admin():
	is_admin = session.get('is_admin', False)

	if not is_admin and not request.url.endswith(url_for('admin.admin_login')):
		return redirect('/')
